<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:pe="http://primefaces.org/ui/extensions">
    <h:head>
        <title>#{bundle.savwd}</title>
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body>
        <ui:composition>
            <h:form>
               <script type="text/javascript">  
                    
                    function handleSavwdApprov(xhr, status, args) {  
                        if(args.validationFailed || !args.success) {  
                            jQuery('#dialog').effect("shake", { times:3 }, 100);  
                        } else {  
                           dlgSavwdApproval.hide();  
                        }  
                    }

                </script>  
                
                <p:toolbar >
                    <p:toolbarGroup align="left">
                        
                        <p:commandButton value="#{bundle.btnOpen}" icon="ui-icon-disk" 
                                        update=":#{utilityBean.findClientId('displaySavwdApproval')}" actionListener="#{savwdApprovalBean.openData()}"
                                        rendered="#{menuBean.cekButtonAccess(103,'APP;')}"
                                        oncomplete="dlgSavwdApproval.show();"> 
                        </p:commandButton>
                            
                        <p:commandButton value="Refresh" icon="ui-icon-arrowrefresh-1-w" update=":#{utilityBean.findClientId('dtSavwdApprovals')}" 
                                         actionListener="#{savwdApprovalBean.loadSavwds()}" >
                        </p:commandButton>
                    </p:toolbarGroup>
                </p:toolbar>
                                                
                <p:dataTable id="dtSavwdApprovals" value="#{savwdApprovalBean.savwds}" var="savwdapprove" 
                    selection="#{savwdApprovalBean.savwd}" selectionMode="single" rowKey="#{savwdapprove.savwdId}" 
                    rowIndexVar="noUrut" emptyMessage=""
                    paginator="true" rows="10" paginatorPosition="bottom" 
                    paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {NextPageLink}"
                    resizableColumns="true">
                                        
                    <p:column style="width: 10px">
                        <f:facet name="header">No.</f:facet>
                        <h:outputText value="#{noUrut+1}" />
                    </p:column>
                    
                    <p:column style="width: 90px">
                        <f:facet name="header">#{bundle.savingNo}</f:facet>
                        <h:outputText value="#{savwdapprove.saving.accountNo}" />
                    </p:column>

                    <p:column style="width: 90px" >
                        <f:facet name="header">#{bundle.cif}</f:facet>
                        <h:outputText value="#{savwdapprove.saving.customer.cif}" />
                    </p:column>
                                        
                    <p:column style="width: 130px" >
                        <f:facet name="header">#{bundle.customer}</f:facet>
                        <h:outputText value="#{savwdapprove.saving.customer.customerName}" />
                    </p:column>
                                        
                    <p:column style="width: 80px" >
                        <f:facet name="header">#{bundle.date}</f:facet>
                        <h:outputText value="#{savwdapprove.transDate}" />
                    </p:column>
                    
                    <p:column style="width: 130px" >
                        <f:facet name="header">#{bundle.amount}</f:facet>
                        <h:outputText value="#{savwdapprove.amount}" styleClass="numPos">
                            <f:convertNumber groupingUsed="true" />
                        </h:outputText>
                    </p:column>
                </p:dataTable>
            </h:form>                    
            
            <p:dialog header="Verifikasi Penarikan Simpanan" widgetVar="dlgSavwdApproval" closable="true" dynamic="true" 
                      appendToBody="true" modal="true" >
                <h:form>
                    <h:panelGrid id="displaySavwdApproval" styleClass="addELIT" cellpadding="0">
                        <h:panelGrid columns="2" cellpadding="1" rowClasses="panelGridId" border="0">
                            <p:panel header="#{bundle.wdLedgend}">
                                <h:panelGrid columns="3" cellpadding="0" cellspacing="10">
                                    <h:outputLabel value= "#{bundle.date}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.transDate}"/>

                                    <h:outputLabel value= "#{bundle.savingNo}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.accountNo}" />

                                    <h:outputLabel value= "#{bundle.saldoAwal}" /><h:outputLabel value=":"/>
                                    <h:outputLabel value="#{savwdApprovalBean.saldoAwal}" styleClass="numPos" >
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputLabel>

                                    <h:outputLabel value= "#{bundle.amount}" /><h:outputLabel value=":" />
                                    <h:outputText styleClass="numPos" value="#{savwdApprovalBean.savwd.amount}" >
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>

                                    <h:outputLabel value= "#{bundle.balance}" /><h:outputLabel value=":"/>
                                    <h:outputLabel value="#{savwdApprovalBean.saldoAkhir}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputLabel>

                                </h:panelGrid>
                            </p:panel>

                            <p:outputPanel autoUpdate="true">
                            <p:panel header="#{bundle.cusledgen}">
                                <h:panelGrid columns="3" style="width: 100%" cellpadding="0" cellspacing="10">
                                    <h:outputLabel value= "#{bundle.cif}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.customer.cif}" />

                                    <h:outputLabel value= "#{bundle.globalName}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.customer.customerName}" />

                                    <h:outputLabel value= "#{bundle.aliasName}" /><h:outputLabel value=":" />
                                    <h:outputText rendered="true" value="#{savwdApprovalBean.savwd.saving.customer.aliasName}" />

                                    <h:outputLabel value= "#{bundle.npwp}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.customer.npwp}" />

                                    <h:outputLabel style="padding: 0 15px 0 0;" value= "#{bundle.officePhone}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.customer.cusper.officePhone}"/>

                                    <h:outputLabel value= "#{bundle.phone}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.customer.phone}"/>

                                    <h:outputLabel value= "#{bundle.mobilePhone}" /><h:outputLabel value=":" />
                                    <h:outputText value="#{savwdApprovalBean.savwd.saving.customer.mobilePhone}"/>
                                </h:panelGrid>
                            </p:panel>
                            </p:outputPanel>
                        </h:panelGrid>
                    </h:panelGrid>
                    
                    <h:panelGrid cellpadding="0" styleClass="pComBtnSTDR">
                        <f:facet name="footer">  
                            <p:commandButton value="#{bundle.approved}" icon="ui-icon-disk" actionListener="#{savwdApprovalBean.approve()}"
                                             update=":#{utilityBean.findClientId('dtSavwdApprovals')}" disabled="#{savwdApprovalBean.savwd == null}"      
                                             rendered="#{menuBean.cekButtonAccess(103,'APP;')}"
                                oncomplete="dlgSavwdApproval.hide()"/>  
                            <p:commandButton value="#{bundle.btnClose}" oncomplete="dlgSavwdApproval.hide()" 
                                icon="ui-icon-document" />
                        </f:facet>
                    </h:panelGrid>
                </h:form>
            </p:dialog>    
            
        </ui:composition>
    </h:body>
</html>